package com.tanhua.server.service;

import com.tanhua.model.vo.OptionsVo;
import com.tanhua.model.vo.QuestionnaireVo;
import com.tanhua.model.vo.QuestionsVo;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class TestSoulService {
    public List<QuestionnaireVo> findQuestionnaire() {
        List<QuestionnaireVo> questionnaireVoList=new ArrayList<>();
        //每次有三张试卷
        for (int i = 1; i < 4; i++) {
            QuestionnaireVo questionnaireVo = new QuestionnaireVo();
            //三张试卷编号
            questionnaireVo.setId(String.valueOf(i));
            //每张试卷都有10道题
            List<QuestionsVo> questionsVoList=new ArrayList<>();
            for (int j = 1; j < 11; j++) {
                QuestionsVo questionsVo = new QuestionsVo();
                questionsVo.setId(String.valueOf(j));
                //每道题有4个选项
                List<OptionsVo> optionsVoList=new ArrayList<>();
                for (int k = 1; k < 5; k++) {
                    OptionsVo optionsVo = new OptionsVo();
                    optionsVo.setId(String.valueOf(k));
                    optionsVoList.add(optionsVo);
                }
                //把每个选项 包装进每道题中
                questionsVo.setOptions(optionsVoList);
                questionsVoList.add(questionsVo);
            }
            //把每张试卷的10道题包装进每张试卷中
            questionnaireVo.setQuestions(questionsVoList);
            if (i==1){
                questionnaireVo.setIsLock(1);
            }else {
                questionnaireVo.setIsLock(1);
            }
            questionnaireVoList.add(questionnaireVo);
        }
//        List<QuestionsVo> questionsVoList=new ArrayList<>();
//        for (int i = 0; i < 10; i++) {
//            QuestionsVo questionsVo = new QuestionsVo();
//
//        }

        return questionnaireVoList;
    }
}
